home *** CD-ROM | disk | FTP | other *** search
/ Chip 1996 November / CHIP Kasım 1996.iso / ms / webpost / wpsdk.exe / RCDATA / CABINET / WIZARD.CPP < prev    next >
C/C++ Source or Header  |  1996-05-15  |  4KB  |  185 lines

  1. /****************************************************************************
  2.  *
  3.  *  CUSTPOST.C
  4.  *
  5.  *  Microsoft Confidential
  6.  *  Copyright (c) Microsoft Corporation 1995-1996
  7.  *  All rights reserved
  8.  *
  9.  ***************************************************************************/
  10.  
  11. #include "wbprov.h"
  12. #include <prsht.h>
  13. #include <commdlg.h>
  14. #include <shlobj.h>
  15. #include "resource.h"
  16.  
  17. // Global variables
  18. extern "C" HINSTANCE g_hInstance;
  19.  
  20. #define NUM_PAGES             3
  21.  
  22. #define SetPropSheetResult(hwnd, result) SetWindowLong(hwnd, DWL_MSGRESULT, result);
  23.  
  24. WORD gIDD_WEBPOST_WPPREV;
  25. WORD gIDD_WEBPOST_WPNEXT;
  26.  
  27. // Local Function Prototype
  28.  
  29.  
  30. //****************************************************************************
  31. //
  32. // ExtPageDlg
  33. //
  34. //****************************************************************************
  35.  
  36. BOOL CALLBACK ExtPageDlg(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
  37. {
  38.     LPPROPSHEETPAGE lpsp;
  39.     UINT            i;
  40.  
  41.     switch (uMsg)
  42.     {
  43.     case WM_INITDIALOG:
  44.         lpsp = (LPPROPSHEETPAGE) lParam;
  45.         SetWindowLong(hDlg,DWL_USER,(LPARAM) lpsp->lParam);
  46.         break;
  47.         
  48.     case WM_COMMAND:
  49.         break;
  50.         
  51.     case WM_NOTIFY:
  52.         switch (((NMHDR FAR *)lParam)->code)
  53.         {
  54.         case PSN_SETACTIVE:
  55.             //OutputDebugString("ExtPageDlg get called setactive\r\n");
  56.             if (!gIDD_WEBPOST_WPPREV &&
  57.                 ((i = GetWindowLong(hDlg,DWL_USER)) == 0))
  58.             {
  59.                 // we are the first page
  60.                 PropSheet_SetWizButtons(GetParent(hDlg), PSWIZB_NEXT);
  61.             }
  62.             else if (!gIDD_WEBPOST_WPNEXT &&
  63.                 ((i = GetWindowLong(hDlg,DWL_USER)) == NUM_PAGES-1))
  64.             {
  65.                 // we are the last page
  66.                 PropSheet_SetWizButtons(GetParent(hDlg), PSWIZB_BACK|PSWIZB_FINISH);
  67.             }
  68.             else
  69.             {
  70.                 PropSheet_SetWizButtons(GetParent(hDlg), PSWIZB_BACK|PSWIZB_NEXT);
  71.             }
  72.             SetPropSheetResult(hDlg,0);
  73.             break;
  74.         case PSN_WIZBACK:
  75.             //OutputDebugString("ExtPageDlg get called wizback\r\n");
  76.             if ((i = GetWindowLong(hDlg,DWL_USER)) == 0)
  77.             {
  78.                 SetPropSheetResult(hDlg,gIDD_WEBPOST_WPPREV);
  79.             }
  80.             else
  81.             {
  82.                 SetPropSheetResult(hDlg,IDD_PAGE_TEST+i-1);
  83.             }
  84.             break;
  85.         case PSN_WIZNEXT:
  86.             // OutputDebugString("ExtPageDlg get called wiznext\r\n");
  87.             if ((i = GetWindowLong(hDlg,DWL_USER)) == NUM_PAGES-1)
  88.             {
  89.                 SetPropSheetResult(hDlg,gIDD_WEBPOST_WPNEXT);
  90.             }
  91.             else if (i == NUM_PAGES -2)
  92.             {
  93.                 SetPropSheetResult(hDlg,IDD_WEBPOST_PROVIDER_LAST);
  94.             }
  95.             else
  96.             {
  97.                 SetPropSheetResult(hDlg,IDD_PAGE_TEST+i+1);
  98.             }
  99.             break;
  100.         default:
  101.             return FALSE;
  102.         }
  103.         break;
  104.         
  105.     default:
  106.         return FALSE;
  107.     }
  108.     return TRUE;
  109. }
  110.  
  111.  
  112. //****************************************************************************
  113. //
  114. // WPPSiteA::AddWizardPages
  115. //
  116. //****************************************************************************
  117.  
  118. STDMETHODIMP
  119. WPPSiteA::AddWizardPages (
  120.     LPVOID            lpv,
  121.     LPFNADDPROPSHEETPAGE    lpfnAdd,
  122.     LPARAM            lParam
  123. )
  124. {
  125.     HPROPSHEETPAGE    page[NUM_PAGES];
  126.     PROPSHEETPAGE     psp[NUM_PAGES];
  127.     BOOL            fOkay = TRUE;
  128.     UINT            i, j;
  129.     UINT *            PageID;
  130.  
  131.  
  132.     //DEBUGPRINTF(("WebPostCustomPageProc get called"));
  133.  
  134.     for (i=0; i<NUM_PAGES && fOkay; i++)
  135.     {
  136.         psp[i].dwSize = sizeof(PROPSHEETPAGE);
  137.         psp[i].dwFlags = PSP_DEFAULT;
  138.         psp[i].hInstance = g_hInstance;
  139.         if (i == NUM_PAGES-1)
  140.             // the last page
  141.             psp[i].pszTemplate = MAKEINTRESOURCE(IDD_WEBPOST_PROVIDER_LAST);
  142.         else
  143.             psp[i].pszTemplate = MAKEINTRESOURCE(IDD_PAGE_TEST+i);
  144.         psp[i].pszIcon = NULL;
  145.         psp[i].pfnDlgProc = (DLGPROC)ExtPageDlg;
  146.         psp[i].lParam = i;
  147.         if ((page[i] = CreatePropertySheetPage(&psp[i])) == 0)
  148.         {
  149.             fOkay = FALSE;
  150.         }
  151.         else
  152.         {
  153.             if (!lpfnAdd( page[i], lParam))
  154.                 fOkay = FALSE;
  155.         }
  156.     }
  157.  
  158.     if (!fOkay)
  159.     {
  160.         for (j=0; j<=i; j++)
  161.             DestroyPropertySheetPage(page[j]);
  162.     }
  163.  
  164.     PageID = (UINT *)lParam;
  165.     gIDD_WEBPOST_WPPREV = HIWORD(*PageID);
  166.     gIDD_WEBPOST_WPNEXT = LOWORD(*PageID);
  167.     *PageID = (IDD_WEBPOST_PROVIDER_FIRST << 16) + IDD_WEBPOST_PROVIDER_LAST;
  168.  
  169.     return (HRESULT_FROM_WIN32(0));
  170. }
  171.  
  172.  
  173. STDMETHODIMP
  174. WPPSiteW::AddWizardPages (
  175.     LPVOID            lpv,
  176.     LPFNADDPROPSHEETPAGE    lpfnAdd,
  177.     LPARAM            lParam
  178. )
  179. {
  180.     OutputDebugString("WPPSiteW: AddWizardPages");
  181.     OutputDebugString("\r\n");
  182.     // Convert to Ansi and call the corresponding A functions
  183.     return ResultFromScode(E_NOTIMPL);
  184. }
  185.